package com.kaisu.blog.web.blog.convert;

import com.kaisu.blog.application.blog.dto.BlogDTO;
import com.kaisu.blog.application.blog.dto.BlogPageDTO;
import com.kaisu.blog.application.blog.dto.CommentPageDTO;
import com.kaisu.blog.web.blog.vo.BlogPageVO;
import com.kaisu.blog.web.blog.vo.BlogVO;
import com.kaisu.blog.web.blog.vo.CommentPageVO;
import com.kaisu.blog.web.user.convert.UserWebConvert;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

/**
 * @author kaisu
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, uses = {UserWebConvert.class})
public interface BlogWebConvert {
    @Mapping(target = "status", source = "status.code")
    BlogVO toVO(BlogDTO dto);

    @Mapping(target = "status", source = "status.code")
    BlogPageVO toPageVO(BlogPageDTO dto);

    CommentPageVO toPageVO(CommentPageDTO dto);
}
